package cn.kgc.mushroomwebui.controller;

import cn.kgc.mushroomcommon.api.ManagerRemoteService;
import cn.kgc.mushroomcommon.pojo.Coll;
import cn.kgc.mushroomcommon.pojo.Shop;
import cn.kgc.mushroomcommon.vo.ShopVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 项目名：mushroom
 * 创建人：Junyizm
 * 创建时间：2020/4/27-22:28
 */
@RestController
public class ShopController {

    @Resource
    ManagerRemoteService managerRemoteService;

    @RequestMapping("/selectAll")
    public List<Shop> selectAll() {
        List<Shop> shops = managerRemoteService.selectAll();
        return shops;
    }
    @RequestMapping("/selectShopComId")
    public Shop selectShopComId(@RequestParam("id")Integer id){
        Shop shops = managerRemoteService.selectShopComId(id);
        return  shops;
    }

    @RequestMapping("/selectByid")
    public Shop selectById(@RequestParam("id")Integer id){
        Shop shop = managerRemoteService.selectById(id);
        return shop;
    }

    @RequestMapping("/insertshopanduser")
    public Map<String,Object> insertshopanduser(@RequestParam("shopcollid")Integer shopcollid, @RequestParam("userid")Integer userid){
        Map<String, Object> insertshopanduser = managerRemoteService.insertshopanduser(shopcollid, userid);
        return insertshopanduser;
    }

    @RequestMapping("/selectColl")
    public List<Coll> selectColl(@RequestParam("userid")Integer userid){
        List<Coll> Coll = managerRemoteService.selectColl(userid);
        return  Coll;
    }

    @RequestMapping("/selectshop/name")
    public List<ShopVO> selectShop(@RequestParam("shopName")String shopName){
        List<ShopVO> shopVOS = managerRemoteService.selectShopByName(shopName);
        return shopVOS;
    }

}
